package collection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;

public class CollectionDemo {
    public static void main(String[] args) {
        Collection<Point> c=new ArrayList<>();
        c.add(new Point(1,2));
        c.add(new Point(3,4));
        c.add(new Point(5,6));
        c.add(new Point(7,8));
        c.add(new Point(9,10));
        c.add(new Point(11,12));
        System.out.println(c);
        Point p=new Point(1,2);
        boolean contains= c.contains(p);
        System.out.println("是否包含:"+contains);
        c.remove(p);
        System.out.println(c);

        Collection<Point>cc=new ArrayList<>();
        Point pp=new Point(1,2);


        Collection<String> c1=new ArrayList<>();
        c1.add("aaa");
        c1.add("bbb");
        c1.add("ccc");
        c1.add("ddd");
        c1.add("eee");
        System.out.println(c1);
        Collection<String> c2=new HashSet<>();
        c2.add("aaa");
        c2.add("bbb");
        c2.add("ccc");
        c2.add("ddd");
        System.out.println(c2);
        Collection<String>c3=new ArrayList<>();
        c3.add("aaa");
        c3.add("bbb");
        c3.add("ccc");
        c3.add("ddd");
        c3.add("eee");
        System.out.println(c3);
        System.out.println("size:"+c3.size());
        System.out.println("是否为空集："+c3.isEmpty());
        c3.clear();
        System.out.println("集合已清空");
        System.out.println(c3);
        System.out.println("size:"+c3.size());
        System.out.println("是否为空集："+c3.isEmpty());




    }
}
